﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using ZLCMS.Business;
using NHibernate;
using ZLCMS.Data.Model;
using NHibernate.Criterion;
using ZLCMS.Business.DwzFrame;
using ZLCMS.Business.Util;
using ZLCMS.Business.TranferParam;
using Newtonsoft.Json;
using System.Text;

namespace ZLCMS.Web.SystemManage.Basics.Param.Group
{
    public partial class Add : System.Web.UI.Page
    {
        protected FrameHelper _framePage;

        protected void Page_Load(object sender, EventArgs e)
        {
            //初始化DWZ控件
            _framePage = new FrameHelper(this);

            //初始化全局变量值
            InitializeGlobalValue();

            //初始化控件值
            InitializeContent();

            if (IsPostBack)
            {
                SaveUser();
            }
        }

        protected void InitializeGlobalValue()
        {
        }

        protected void InitializeContent()
        {
            //页面控件数据

            //页面控件值
            if (!IsPostBack)
            {
            }
        }

        protected void SaveUser()
        {
            using (ISession session = DotNet.Common.NHibernateUtil.SessionFactoryHelper.CreateSession())
            {
                SysParam gourpDB = new SysParam(); ;

                gourpDB.GroupCode = "TranferParam";
                gourpDB.ItemCode = tb_code.Text;
                gourpDB.ItemValue = tb_value.Text;
                gourpDB.Param1 = tb_param1.Text;
                gourpDB.Param2 = tb_param2.Text;
                gourpDB.Memo = tb_memo.Text;

                session.Save(gourpDB);
                session.Flush();

                _framePage.Alert(new ReturnCode()
                {
                    statusCode = 200,
                    message = "操作成功!",
                    callbackType = "closeCurrent",
                    navTabId = _framePage.NavTabId
                });
            }
        }
    }
}